package com.scuec.tourismwebsite.controller;

import com.scuec.tourismwebsite.entity.UserFocus;
import com.scuec.tourismwebsite.service.UserFocusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("tour/v1")
public class UserFocusController {
    @Autowired
    private UserFocusService userFocusService;

    @DeleteMapping("focus")
    public Integer deleteUserFocus(@RequestParam("focused_id") int focused_id,@RequestParam("user_id") int user_id){
        return userFocusService.deleteUserFocus(focused_id, user_id);
    }

    @GetMapping("focus")
    public List<UserFocus> getUserFocus(@RequestParam("focused_id") int focused_id, @RequestParam("user_id") int user_id){
        return userFocusService.getUserFocus(focused_id, user_id);
    }

    @PostMapping("focus/{focused_id}/{user_id}")
    public Integer insertUserFocus(@PathVariable("focused_id") int focused_id,@PathVariable("user_id") int user_id){
        return userFocusService.insertUserFocus(focused_id, user_id);
    }
}
